﻿package com.amcharts.utils
{
    import flash.display.*;
    import flash.events.*;
    import mx.core.*;

    public class AmPushButton extends UIComponent
    {
        private var _iconPushed:DisplayObject;
        private var _icon:DisplayObject;
        private var _pushed:Boolean;
        static const VERSION:String = "1.8.3.1";

        public function AmPushButton(param1:Class, param2:Class)
        {
            this.useHandCursor = true;
            this.buttonMode = true;
            _iconPushed = DisplayObject(new param2);
            this.addChild(_iconPushed);
            _icon = DisplayObject(new param1);
            this.addChild(_icon);
            this.addEventListener(MouseEvent.ROLL_OVER, handleMouseOver);
            this.addEventListener(MouseEvent.ROLL_OUT, handleMouseOut);
            return;
        }// end function

        private function handleMouseOver(event:MouseEvent) : void
        {
            _icon.visible = false;
            return;
        }// end function

        public function set pushed(param1:Boolean) : void
        {
            _pushed = param1;
            _icon.visible = !param1;
            return;
        }// end function

        private function handleMouseOut(event:MouseEvent) : void
        {
            if (!_pushed)
            {
                _icon.visible = true;
            }
            return;
        }// end function

    }
}
